/*********************************************************************************
Organization 					: 				Georgia Institute of Technology
  
Institute 						:				Cognitive Computing Group(CCL)
 
Authors							: 				Santiago Ontanon
 												
Class							:				OrCondition
 
Function						: 				Provides a class for OR condition
****************************************************************************/
package planninglanguage.softconditions;

import base.WargusGameState;


public class OrSoftCondition extends SoftCondition {

	SoftCondition m_c1,m_c2;

	public OrSoftCondition(SoftCondition a_c1,SoftCondition a_c2)
	{
		m_c1=a_c1;
		m_c2=a_c2;
	}
	
	public SoftCondition getC1() {
		return m_c1;
	}
	
	public SoftCondition getC2() {
		return m_c2;
	}
	
	public void reset()
	{
		m_c1.reset();
		m_c2.reset();
	}	
	
	public float test(WargusGameState a_gameState)
	{
		return Math.max(m_c1.test(a_gameState),m_c2.test(a_gameState));
	}
	
	public String toString(int tabs) {
		String str= super.toString(tabs);
		int i;
		
		for(i=0;i<tabs;i++) str = str + "  ";
		str = str +  "SoftOr(\n";
		if (m_c1!=null)	{
			str = str + m_c1.toString(tabs+1) + "\n";
		} else {
			for(i=0;i<tabs+1;i++) str = str + "  ";
			str = str +  "null\n";
		}  
		if (m_c2!=null)	{
			str = str + m_c2.toString(tabs+1) + "\n";
		} else {
			for(i=0;i<tabs+1;i++) str = str + "  ";
			str = str +  "null\n";
		}  
		for(i=0;i<tabs;i++) str = str + "  ";
		str = str +  ")";
		return str;
	}	

}
